<?php

/**
 * This is the model class for table "produksijamurkayu".
 *
 * The followings are the available columns in table 'produksijamurkayu':
 * @property integer $pjk_id
 * @property integer $pjk_kec
 * @property double $pjk_log
 * @property double $pjk_produksi
 * @property integer $pjk_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $pjkKec
 */
class Produksijamurkayu extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Produksijamurkayu the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'produksijamurkayu';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('pjk_kec, pjk_tahun', 'numerical', 'integerOnly'=>true),
			array('pjk_log, pjk_produksi', 'numerical'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('pjk_id, pjk_kec, pjk_log, pjk_produksi, pjk_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'pjkKec' => array(self::BELONGS_TO, 'Kecamatan', 'pjk_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'pjk_id' => 'Pjk',
			'pjk_kec' => 'Pjk Kec',
			'pjk_log' => 'Pjk Log',
			'pjk_produksi' => 'Pjk Produksi',
			'pjk_tahun' => 'Pjk Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('pjk_id',$this->pjk_id);
		$criteria->compare('pjk_kec',$this->pjk_kec);
		$criteria->compare('pjk_log',$this->pjk_log);
		$criteria->compare('pjk_produksi',$this->pjk_produksi);
		$criteria->compare('pjk_tahun',$this->pjk_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}